---
layout: post
title: 试试echarts能不能啦
categories: Geek
tags:
keywords:
description:
---

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="http://www.guofei.site/public/jsforecharts/echarts.min.js"></script>
	<!-- <script src="http://www.guofei.site/public/jsforecharts/jquery-3.2.1.min.js"></script>-->
	<script src="http://www.guofei.site/public/jsforecharts/china.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="width: 1200px;height:800px;"></div>



<script>
var myChart = echarts.init(document.getElementById('main'));
// 显示标题，图例和空的坐标轴
myChart.setOption({
    title: {
        text: 'iPhone销量',
        subtext: '模拟数据',
        left: 'center'
    },
    tooltip: {
        trigger: 'item'
    },
    legend: {
        orient: 'vertical',
        left: 'left',
        data:['iphone3','iphone4','iphone5']
    },
    visualMap: {
        min: 0,
        max: 200,
        left: 'left',
        top: 'bottom',
        text: ['高','低'],           // 文本，默认为数值文本
        calculable: true
    },
    toolbox: {
        show: true,
        orient: 'vertical',
        left: 'right',
        top: 'center',
        feature: {
            dataView: {readOnly: false},
            restore: {},
            saveAsImage: {}
        }
    },
    series: [
        {
            name: 'iPhone销量',
            type: 'map',
            mapType: 'china',
            roam: false,
            label: {
                normal: {
                    show: true
                },
                emphasis: {
                    show: true
                }
            },
            data:[]
		}
		]
	});

// 异步加载数据
	setInterval(function (){
$.getJSON('http://www.guofei.site/public/jsforecharts/data.json').done(function (data) {
    // 填入数据
	//document.write(data)
    myChart.setOption({
        series: {
            data: data
        },

    });
});

		},500);
</script>

</body>
</html>
